package com.sia.springcloud.kafka;

import org.apache.kafka.common.serialization.Serializer;

import java.util.Map;

/**
 * @Author: Sirius
 * @Date: 2022/5/16 10:56
 * @Description:
 **/
public class EncodeingKafka implements Serializer<Object> {
    @Override
    public void configure(Map configs, boolean isKey) {

    }

    @Override
    public byte[] serialize(String topic, Object data) {
        return BeanUtils.ObjectToBytes(data);
    }

    /*
     * producer调用close()方法是调用
     */
    @Override
    public void close() {
        System.out.println("EncodeingKafka is close");
    }
}

